import { useRef } from 'react';

import {
  ExportOutlined,
  ImportOutlined,
  PlusOutlined,
  ReloadOutlined,
  SettingOutlined,
} from '@ant-design/icons';

import { type DeviceItem } from '@/api/deviceManagerApi';
import {
  equipmentProductUpdateMetaDataApi,
  type ProductDetailItem,
} from '@/api/equipmentProductApi';
import {
  DataTypeList,
  FunctionCatList,
  FunctionTypeList,
  type OperationType,
  OperationTypeList,
  ReadWriteTypeList,
  typeToValueEnum,
} from '@/constants';
import { TableLocalePresets } from '@/utils/tableUtils';

import ModelAddForm from './ModelAddForm';
import ModelDetailView from './ModelDetailView';

import type { ActionType, ProColumns } from '@ant-design/pro-components';

const ModelArchiveTable = (props: { activeItem: ProductDetailItem; onRefresh: () => void }) => {
  const { activeItem = {}, onRefresh } = props;
  const _navigate = useNavigate();
  const actionRef = useRef<ActionType>(null);
  const [form] = AForm.useForm();
  const [drawerShow, setDrawerShow] = useState(false);
  const [drawerType, setDrawerType] = useState<OperationType>('ADD');
  const [currentRecord, setCurrentRecord] = useState<any>({});
  const listData = useMemo(() => {
    try {
      if (activeItem?.metaDataObj) {
        // 确保 metaDataObj 是字符串类型
        const metaDataStr =
          typeof activeItem.metaDataObj === 'string'
            ? activeItem.metaDataObj
            : JSON.stringify(activeItem.metaDataObj);

        const rawData = JSON.parse(metaDataStr);

        // 确保 rawData 是数组
        if (!Array.isArray(rawData)) {
          console.warn('metaDataObj 解析后不是数组格式:', rawData);
          return [];
        }

        // 处理数据格式，确保表格显示正确
        return rawData
          .map((item: any) => {
            if (!item || typeof item !== 'object') {
              console.warn('无效的物模型数据项:', item);
              return null;
            }

            return {
              ...item,
              // 如果 dataType 是对象，提取 type 字段用于显示
              dataType:
                typeof item.dataType === 'object' && item.dataType?.type
                  ? item.dataType.type
                  : item.dataType || '',
              // 保留原始的 dataType 对象用于编辑
              originalDataType: item.dataType,
            };
          })
          .filter(Boolean); // 过滤掉 null 值
      }
    } catch (error) {
      console.error('解析物模型数据失败:', error, activeItem?.metaDataObj);
    }
    return [];
  }, [activeItem]);
  // 列表请求
  const fetchData = async (params: Record<string, unknown>) => {
    console.log('物模型查询参数:', params);

    try {
      // 获取查询参数
      const { name, type, functionType, ...otherParams } = params;
      console.log('listData', listData);

      // 确保 listData 是数组
      if (!Array.isArray(listData)) {
        console.warn('listData 不是数组格式:', listData);
        return {
          data: [],
          success: true,
          total: 0,
        };
      }

      // 本地过滤数据
      let filteredData = [...listData];

      // 按名称过滤
      if (name && typeof name === 'string') {
        filteredData = filteredData.filter(item =>
          item.name?.toLowerCase().includes(name.toLowerCase())
        );
      }

      // 按类型过滤
      if (type && type !== 'all') {
        filteredData = filteredData.filter(item => item.type === type);
      }

      // 按状态过滤
      if (functionType && functionType !== 'all') {
        filteredData = filteredData.filter(item => item.functionType === functionType);
      }

      // 其他自定义过滤条件
      Object.keys(otherParams).forEach(key => {
        const value = otherParams[key];
        if (value && value !== 'all' && value !== '') {
          filteredData = filteredData.filter(item => {
            const itemValue = (item as Record<string, unknown>)[key];
            if (typeof value === 'string' && typeof itemValue === 'string') {
              return itemValue.toLowerCase().includes(value.toLowerCase());
            }
            return itemValue === value;
          });
        }
      });

      return {
        data: filteredData,
        success: true,
        total: filteredData.length,
      };
    } catch (error) {
      console.error('fetchData 处理数据时出错:', error);
      return {
        data: [],
        success: false,
        total: 0,
      };
    }
  };

  // 表格列定义
  const columns: ProColumns<DeviceItem>[] = [
    {
      title: '功能类型',
      dataIndex: 'type',
      key: 'type',
      valueEnum: typeToValueEnum(FunctionTypeList),
    },
    {
      title: '功能类别',
      dataIndex: 'functionType',
      key: 'functionType',
      valueEnum: typeToValueEnum(FunctionCatList),
    },
    {
      title: '功能名称',
      dataIndex: 'name',
      key: 'name',
    },
    {
      title: '标识符',
      dataIndex: 'identifier',
      key: 'identifier',
      search: false,
    },
    {
      title: '数据类型',
      dataIndex: 'dataType',
      key: 'dataType',
      valueEnum: typeToValueEnum(DataTypeList),
      search: false,
      render: (text: any) => {
        // 现在 dataType 已经在 listData 中处理过了，直接返回
        return text || '-';
      },
    },
    {
      title: '读写类型',
      dataIndex: 'accessMode',
      key: 'accessMode',
      valueEnum: typeToValueEnum(ReadWriteTypeList),
      search: false,
    },
    {
      title: '操作',
      key: 'action',
      width: 200,
      fixed: 'right',
      search: false,
      render: (_, record) => {
        // 确保 record 存在且有必要的属性
        if (!record || typeof record !== 'object') {
          return <span>-</span>;
        }

        return (
          <ASpace size="small">
            <AButton
              type="link"
              size="small"
              onClick={() => {
                try {
                  handleView(record);
                } catch (error) {
                  console.error('查看功能点时出错:', error);
                  window.$message.error('查看功能点失败');
                }
              }}
            >
              查看
            </AButton>
            <AButton
              type="link"
              size="small"
              onClick={() => {
                try {
                  handleEdit(record);
                } catch (error) {
                  console.error('编辑功能点时出错:', error);
                  window.$message.error('编辑功能点失败');
                }
              }}
            >
              编辑
            </AButton>
            <AButton
              type="link"
              size="small"
              danger
              onClick={() => {
                try {
                  handleDelete(record);
                } catch (error) {
                  console.error('删除功能点时出错:', error);
                  window.$message.error('删除功能点失败');
                }
              }}
            >
              删除
            </AButton>
          </ASpace>
        );
      },
    },
  ];
  const handleDrawerClose = () => {
    setCurrentRecord({});
    setDrawerType('ADD');
    setDrawerShow(false);
  };

  // 编辑功能点
  const handleEdit = (record: any) => {
    try {
      console.log('编辑记录:', record);

      // 确保 record 存在且有必要的属性
      if (!record || typeof record !== 'object') {
        console.error('无效的记录数据:', record);
        window.$message.error('无效的功能点数据');
        return;
      }

      setCurrentRecord(record);
      setDrawerType('EDIT');

      // 设置表单初始值
      // 处理 dataType 字段，可能是字符串或对象格式
      let actualDataType = record.dataType;
      let dataTypeFields: any = {};

      // 如果 dataType 是对象格式，提取类型和配置信息
      if (typeof record.dataType === 'object' && record.dataType?.type) {
        actualDataType = record.dataType.type;
        const specs = record.dataType.specs || {};
        dataTypeFields = {
          min: specs.min || record.min,
          max: specs.max || record.max,
          step: specs.step || record.step,
          unit: specs.unit || record.unit,
          dataLen: specs.length || record.dataLen,
          boolT: specs.true || record.boolT,
          boolF: specs.false || record.boolF,
        };
      } else {
        // 如果 dataType 是字符串格式，使用 record 中的其他字段
        dataTypeFields = {
          min: record.min,
          max: record.max,
          step: record.step,
          unit: record.unit,
          dataLen: record.dataLen,
          boolT: record.boolT,
          boolF: record.boolF,
        };
      }

      // 处理 originalDataType 中的配置信息（如果存在）
      if (
        record.originalDataType &&
        typeof record.originalDataType === 'object' &&
        record.originalDataType.specs
      ) {
        const originalSpecs = record.originalDataType.specs;
        dataTypeFields = {
          ...dataTypeFields,
          min: originalSpecs.min || dataTypeFields.min,
          max: originalSpecs.max || dataTypeFields.max,
          step: originalSpecs.step || dataTypeFields.step,
          unit: originalSpecs.unit || dataTypeFields.unit,
          dataLen: originalSpecs.length || dataTypeFields.dataLen,
          boolT: originalSpecs.true || dataTypeFields.boolT,
          boolF: originalSpecs.false || dataTypeFields.boolF,
        };
      }

      form.setFieldsValue({
        name: record.name,
        identifier: record.identifier,
        type: record.type,
        dataType: actualDataType,
        accessMode: record.accessMode,
        remark: record.remark || record.desc,
        callType: record.callType,
        paramList: record.paramList || [],
        inputData: record.inputData || [],
        outputData: record.outputData || [],
        // 数据类型相关字段
        ...dataTypeFields,
        // 其他字段
        domains: record.domains || [],
        dataLenUnit: record.dataLenUnit,
        arrayDataType: record.arrayDataType,
        len: record.len,
        dateFormat: record.dateFormat,
      });

      setDrawerShow(true);
    } catch (error) {
      console.error('编辑功能点时出错:', error);
      window.$message.error('编辑功能点失败');
    }
  };

  // 查看功能点
  const handleView = (record: any) => {
    try {
      console.log('查看记录:', record);

      // 确保 record 存在且有必要的属性
      if (!record || typeof record !== 'object') {
        console.error('无效的记录数据:', record);
        window.$message.error('无效的功能点数据');
        return;
      }

      setCurrentRecord(record);
      setDrawerType('DETAIL');

      // 设置表单初始值（只读模式）
      // 使用与编辑相同的数据处理逻辑
      const originalDataType = record.originalDataType || record.dataType;
      let dataTypeFields: any = {};

      if (typeof originalDataType === 'object' && originalDataType?.specs) {
        const specs = originalDataType.specs;
        dataTypeFields = {
          min: specs.min,
          max: specs.max,
          step: specs.step,
          unit: specs.unit,
          length: specs.length,
          dataLen: specs.length,
          boolT: specs.true,
          boolF: specs.false,
          domains:
            specs && typeof specs === 'object' && !Array.isArray(specs)
              ? Object.keys(specs).map(key => ({ value: key, desc: specs[key] }))
              : [],
        };
      }

      form.setFieldsValue({
        name: record.name,
        identifier: record.identifier,
        type: record.type,
        dataType: typeof originalDataType === 'object' ? originalDataType.type : originalDataType,
        accessMode: record.accessMode,
        remark: record.remark,
        callType: record.callType,
        paramList: record.paramList || [],
        inputData: record.inputData || [],
        outputData: record.outputData || [],
        // 数据类型相关字段
        ...dataTypeFields,
        domains: record.domains || dataTypeFields.domains,
        boolT: record.boolT || dataTypeFields.boolT,
        boolF: record.boolF || dataTypeFields.boolF,
        dataLen: record.dataLen || dataTypeFields.dataLen,
        dataLenUnit: record.dataLenUnit,
        arrayDataType: record.arrayDataType,
        len: record.len,
        min: record.min || dataTypeFields.min,
        max: record.max || dataTypeFields.max,
        step: record.step || dataTypeFields.step,
        unit: record.unit || dataTypeFields.unit,
        dateFormat: record.dateFormat,
      });

      setDrawerShow(true);
    } catch (error) {
      console.error('查看功能点时出错:', error);
      window.$message.error('查看功能点失败');
    }
  };

  // 删除功能点
  const handleDelete = (record: any) => {
    // 确保 record 存在且有必要的属性
    if (!record || typeof record !== 'object' || !record.name) {
      console.error('无效的记录数据:', record);
      window.$message.error('无效的功能点数据');
      return;
    }

    AModal.confirm({
      title: '确认删除',
      content: `确定要删除功能点"${record.name}"吗？`,
      onOk: async () => {
        try {
          // 从列表中移除该项
          const newListData = listData.filter(
            item => item.identifier !== record.identifier || item.type !== record.type
          );

          // 构建删除后的数据
          const metaData = handleConvertDataFromList(newListData);

          // 调用API更新
          const res = await equipmentProductUpdateMetaDataApi({
            metaData,
            metaDataObj: newListData,
            productCode: activeItem.mqttUserName,
          });

          if (res.success) {
            window.$message.success('删除成功');
            onRefresh(() => {
              actionRef.current?.reload();
            });
          }
        } catch (error) {
          console.error('删除失败:', error);
          window.$message.error('删除失败');
        }
      },
    });
  };
  const handleSubmit = async () => {
    try {
      const params = await form.validateFields();
      const newParams = {
        ...currentRecord,
        ...params,
      };
      console.log('提交参数:', newParams);

      let newListData;
      if (drawerType === 'EDIT') {
        // 编辑模式：更新现有项
        newListData = listData.map(item => {
          if (item.identifier === currentRecord.identifier && item.type === currentRecord.type) {
            return newParams;
          }
          return item;
        });
      } else {
        // 添加模式：添加新项
        newListData = [...listData, newParams];
      }

      const data = handleConvertDataFromList(newListData);
      const res = await equipmentProductUpdateMetaDataApi(data);
      if (res.success) {
        window.$message.success(drawerType === 'EDIT' ? '编辑成功' : '添加成功');
        onRefresh(() => {
          actionRef.current?.reload();
        });
        form.resetFields();
        handleDrawerClose();
      } else {
        window.$message.error(res.message || '操作失败');
      }
    } catch (error) {
      console.error('提交物模型数据时出错:', error);
      window.$message.error('操作失败，请重试');
    }
  };

  // 从列表数据构建API所需的数据格式
  const handleConvertDataFromList = (sourceData: any[]) => {
    const props: any[] = [];
    const events: any[] = [];
    const services: any[] = [];

    // 确保 sourceData 是数组且不为空
    if (!Array.isArray(sourceData)) {
      console.warn('sourceData 不是数组格式:', sourceData);
      return {
        metaData: { properties: [], events: [], services: [] },
        metaDataObj: [],
        productCode: activeItem.mqttUserName,
      };
    }

    sourceData.forEach(item => {
      // 确保 item 存在且有必要的属性
      if (!item || typeof item !== 'object' || !item.type) {
        console.warn('跳过无效的物模型数据项:', item);
        return;
      }
      if (item.type === 'properties') {
        let obj = {};
        if (
          item.dataType === 'int32' ||
          item.dataType === 'int64' ||
          item.dataType === 'float' ||
          item.dataType === 'double'
        ) {
          obj = {
            accessMode: item.accessMode,
            dataType: {
              type: item.dataType,
              specs: {
                min: item.min,
                max: item.max,
                unit: item.unit,
                step: item.step,
              },
            },
          };
        } else if (item.dataType === 'enum') {
          const obj1: any = {};
          item.domains?.forEach((val: any) => {
            obj1[val.value] = val.desc;
          });
          obj = {
            dataType: {
              type: 'enum',
              specs: obj1,
            },
          };
        } else if (item.dataType === 'bool') {
          obj = {
            accessMode: item.accessMode,
            dataType: {
              type: 'bool',
              specs: {
                true: item.boolT,
                false: item.boolF,
              },
            },
          };
        } else if (item.dataType === 'string') {
          obj = {
            accessMode: item.accessMode,
            dataType: {
              type: 'string',
              specs: {
                length: item.dataLen,
              },
            },
          };
        } else if (item.dataType === 'date') {
          obj = {
            accessMode: item.accessMode,
            dataType: {
              type: 'date',
              specs: {},
            },
          };
        } else {
          obj = {
            accessMode: item.accessMode,
            dataType: {
              type: item.dataType,
              specs: {
                length: item.dataLen,
              },
            },
          };
        }
        props.push(Object.assign(item, obj));
      } else if (item.type === 'events') {
        const arr: any[] = [];
        item.paramList?.forEach((item1: any) => {
          let obj = {};
          if (
            item1.dataType === 'int32' ||
            item1.dataType === 'int64' ||
            item1.dataType === 'float' ||
            item1.dataType === 'double'
          ) {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: item1.dataType,
                specs: {
                  min: item1.min,
                  max: item1.max,
                  unit: item1.unit,
                  step: item1.step,
                },
              },
            };
          } else if (item1.dataType === 'enum') {
            const obj1: any = {};
            item1.domains?.forEach((val: any) => {
              obj1[val.value] = val.desc;
            });
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'enum',
                specs: obj1,
              },
            };
          } else if (item1.dataType === 'bool') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'bool',
                specs: {
                  true: item1.boolT,
                  false: item1.boolF,
                },
              },
            };
          } else if (item1.dataType === 'string') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'string',
                specs: {
                  length: item1.dataLen,
                },
              },
            };
          } else if (item1.dataType === 'date') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'date',
                specs: {},
              },
            };
          } else {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: item1.dataType,
                specs: {
                  length: item1.dataLen,
                },
              },
            };
          }
          arr.push(obj);
        });
        const newObj = {
          list: arr,
        };
        events.push(Object.assign(item, newObj));
      } else if (item.type === 'services') {
        const inputArr: any[] = [];
        const outputArr: any[] = [];

        // 处理输入参数
        item.inputData?.forEach((item1: any) => {
          let obj = {};
          if (
            item1.dataType === 'int32' ||
            item1.dataType === 'int64' ||
            item1.dataType === 'float' ||
            item1.dataType === 'double'
          ) {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: item1.dataType,
                specs: {
                  min: item1.min,
                  max: item1.max,
                  unit: item1.unit,
                  step: item1.step,
                },
              },
            };
          } else if (item1.dataType === 'enum') {
            const obj1: any = {};
            item1.domains?.forEach((val: any) => {
              obj1[val.value] = val.desc;
            });
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'enum',
                specs: obj1,
              },
            };
          } else if (item1.dataType === 'bool') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'bool',
                specs: {
                  true: item1.boolT,
                  false: item1.boolF,
                },
              },
            };
          } else if (item1.dataType === 'string') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'string',
                specs: {
                  length: item1.dataLen,
                },
              },
            };
          } else if (item1.dataType === 'date') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'date',
                specs: {},
              },
            };
          } else {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: item1.dataType,
                specs: {
                  length: item1.dataLen,
                },
              },
            };
          }
          inputArr.push(obj);
        });

        // 处理输出参数
        item.outputData?.forEach((item1: any) => {
          let obj = {};
          if (
            item1.dataType === 'int32' ||
            item1.dataType === 'int64' ||
            item1.dataType === 'float' ||
            item1.dataType === 'double'
          ) {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: item1.dataType,
                specs: {
                  min: item1.min,
                  max: item1.max,
                  unit: item1.unit,
                  step: item1.step,
                },
              },
            };
          } else if (item1.dataType === 'enum') {
            const obj1: any = {};
            item1.domains?.forEach((val: any) => {
              obj1[val.value] = val.desc;
            });
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'enum',
                specs: obj1,
              },
            };
          } else if (item1.dataType === 'bool') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'bool',
                specs: {
                  true: item1.boolT,
                  false: item1.boolF,
                },
              },
            };
          } else if (item1.dataType === 'string') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'string',
                specs: {
                  length: item1.dataLen,
                },
              },
            };
          } else if (item1.dataType === 'date') {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: 'date',
                specs: {},
              },
            };
          } else {
            obj = {
              identifier: item1.identifier,
              name: item1.name,
              dataType: {
                type: item1.dataType,
                specs: {
                  length: item1.dataLen,
                },
              },
            };
          }
          outputArr.push(obj);
        });

        const newObj = {
          input: inputArr,
          output: outputArr,
        };
        services.push(Object.assign(item, newObj));
      }
    });

    // 构建最终的元数据格式
    const newArray: any[] = [];
    const newArray1: any[] = [];
    const newArray2: unknown[] = [];

    props.forEach(val => {
      const newObj = {
        identifier: val.identifier,
        name: val.name,
        functionType: 'u',
        accessMode: val.accessMode,
        type: val.type,
        desc: val.desc,
        dataType: val.dataType,
      };
      newArray.push(newObj);
    });

    events.forEach(value => {
      const newObj = {
        identifier: value.identifier,
        name: value.name,
        functionType: 'u',
        type: value.type,
        desc: value.desc,
        eventType: value.eventType,
        outputData: value.list,
      };
      newArray1.push(newObj);
    });

    services.forEach(value => {
      const newObj = {
        identifier: value.identifier,
        name: value.name,
        functionType: 'u',
        type: value.type,
        desc: value.desc,
        eventType: value.eventType,
        callType: value.callType,
        inputData: value.input,
        outputData: value.output,
      };
      newArray2.push(newObj);
    });

    const metaData = {
      properties: newArray,
      events: newArray1,
      services: newArray2,
    };

    return {
      metaData,
      metaDataObj: sourceData,
      productCode: activeItem.mqttUserName,
    };
  };

  return (
    <div className="w-full">
      <ADrawer
        destroyOnHidden
        title={`物模型${OperationTypeList[drawerType].label}`}
        width={600}
        closable={{ 'aria-label': 'Close Button' }}
        footer={
          <ARow justify="end">
            <ASpace>
              <AButton
                onClick={() => {
                  setDrawerShow(false);
                }}
              >
                返回
              </AButton>
              {drawerType != 'DETAIL' && (
                <AButton type="primary" onClick={handleSubmit}>
                  提交
                </AButton>
              )}
            </ASpace>
          </ARow>
        }
        onClose={handleDrawerClose}
        open={drawerShow}
      >
        <div className="w-full px-8 py-8">
          {drawerType === 'DETAIL' ? (
            <ModelDetailView data={currentRecord} />
          ) : (
            <AForm form={form} layout="vertical" labelAlign="right" labelCol={{ span: 24 }}>
              <ModelAddForm form={form} readonly={false} />
            </AForm>
          )}
        </div>
      </ADrawer>
      <PProTable<DeviceItem>
        className="mh-table"
        actionRef={actionRef}
        columns={columns}
        request={fetchData}
        rowKey="name"
        search={{
          span: 6,
          labelWidth: 'auto',
          defaultCollapsed: false,
        }}
        pagination={false}
        scroll={{ x: 1000 }}
        size="small"
        options={{
          density: false,
          reloadIcon: (
            <AButton icon={<ReloadOutlined />} key="reload">
              刷新
            </AButton>
          ),
          setting: {
            draggable: true,
            checkable: true,
            showListItemOption: true,
            settingIcon: <AButton icon={<SettingOutlined />}>设置</AButton>,
            listsHeight: 400,
          },
        }}
        toolBarRender={() => [
          <AButton
            key="export"
            icon={<ExportOutlined />}
            type="primary"
            onClick={() => {
              window.$message.success('开发中...');
            }}
          >
            导出物模型
          </AButton>,
          <AButton
            key="import"
            icon={<ImportOutlined />}
            onClick={() => {
              window.$message.success('开发中...');
            }}
          >
            导入物模型
          </AButton>,
          // <AButton
          //   key="download"
          //   icon={<DownloadOutlined />}
          //   onClick={() => {
          //     window.$message.success('开发中...');
          //   }}
          // >
          //   下载SDK
          // </AButton>,
          <AButton
            key="add"
            icon={<PlusOutlined />}
            type="primary"
            onClick={() => {
              form.resetFields();
              setCurrentRecord({});
              setDrawerType('ADD');
              setDrawerShow(true);
            }}
          >
            添加自定义功能点
          </AButton>,
        ]}
        locale={TableLocalePresets.device(actionRef)}
      />
    </div>
  );
};

export default ModelArchiveTable;
